<div class="problemindexholder" problemindex="B">
 <div class="ttypography">
  <div class="problem-statement">
   <div class="header">
    <div class="title">
     B. Arpa and a list of numbers
    </div>
    <div class="time-limit">
     <div class="property-title">
      time limit per test
     </div>
     2 seconds
    </div>
    <div class="memory-limit">
     <div class="property-title">
      memory limit per test
     </div>
     256 megabytes
    </div>
    <div class="input-file">
     <div class="property-title">
      input
     </div>
     standard input
    </div>
    <div class="output-file">
     <div class="property-title">
      output
     </div>
     standard output
    </div>
   </div>
   <div>
    <p>
     Arpa has found a list containing
     <span class="tex-span">
      <i>
       n
      </i>
     </span>
     numbers. He calls a list bad if and only if it is not empty and
     <span class="tex-font-style-tt">
      gcd
     </span>
     (see notes section for more information) of numbers in the list is
     <span class="tex-span">
      1
     </span>
     .
    </p>
    <p>
     Arpa can perform two types of operations:
    </p>
    <ul>
     <li>
      Choose a number and delete it with cost
      <span class="tex-span">
       <i>
        x
       </i>
      </span>
      .
     </li>
     <li>
      Choose a number and increase it by
      <span class="tex-span">
       1
      </span>
      with cost
      <span class="tex-span">
       <i>
        y
       </i>
      </span>
      .
     </li>
    </ul>
    <p>
     Arpa can apply these operations to as many numbers as he wishes, and he is allowed to apply the second operation arbitrarily many times on the same number.
    </p>
    <p>
     Help Arpa to find the minimum possible cost to make the list good.
    </p>
   </div>
   <div class="input-specification">
    <div class="section-title">
     Input
    </div>
    <p>
     First line contains three integers
     <span class="tex-span">
      <i>
       n
      </i>
     </span>
     ,
     <span class="tex-span">
      <i>
       x
      </i>
     </span>
     and
     <span class="tex-span">
      <i>
       y
      </i>
     </span>
     (
     <span class="tex-span">
      1 ≤
      <i>
       n
      </i>
      ≤ 5·10
      <sup class="upper-index">
       5
      </sup>
     </span>
     ,
     <span class="tex-span">
      1 ≤
      <i>
       x
      </i>
      ,
      <i>
       y
      </i>
      ≤ 10
      <sup class="upper-index">
       9
      </sup>
     </span>
     ) — the number of elements in the list and the integers
     <span class="tex-span">
      <i>
       x
      </i>
     </span>
     and
     <span class="tex-span">
      <i>
       y
      </i>
     </span>
     .
    </p>
    <p>
     Second line contains
     <span class="tex-span">
      <i>
       n
      </i>
     </span>
     integers
     <span class="tex-span">
      <i>
       a
      </i>
      <sub class="lower-index">
       1
      </sub>
      ,
      <i>
       a
      </i>
      <sub class="lower-index">
       2
      </sub>
      , ...,
      <i>
       a
      </i>
      <sub class="lower-index">
       <i>
        n
       </i>
      </sub>
     </span>
     (
     <span class="tex-span">
      1 ≤
      <i>
       a
      </i>
      <sub class="lower-index">
       <i>
        i
       </i>
      </sub>
      ≤ 10
      <sup class="upper-index">
       6
      </sup>
     </span>
     ) — the elements of the list.
    </p>
   </div>
   <div class="output-specification">
    <div class="section-title">
     Output
    </div>
    <p>
     Print a single integer: the minimum possible cost to make the list good.
    </p>
   </div>
   <div class="sample-tests">
    <div class="section-title">
     Examples
    </div>
    <div class="sample-test">
     <div class="input">
      <div class="title">
       Input
      </div>
      <pre>4 23 17<br/>1 17 17 16<br/></pre>
     </div>
     <div class="output">
      <div class="title">
       Output
      </div>
      <pre>40<br/></pre>
     </div>
     <div class="input">
      <div class="title">
       Input
      </div>
      <pre>10 6 2<br/>100 49 71 73 66 96 8 60 41 63<br/></pre>
     </div>
     <div class="output">
      <div class="title">
       Output
      </div>
      <pre>10<br/></pre>
     </div>
    </div>
   </div>
   <div class="note">
    <div class="section-title">
     Note
    </div>
    <p>
     In example, number
     <span class="tex-span">
      1
     </span>
     must be deleted (with cost
     <span class="tex-span">
      23
     </span>
     ) and number
     <span class="tex-span">
      16
     </span>
     must increased by
     <span class="tex-span">
      1
     </span>
     (with cost
     <span class="tex-span">
      17
     </span>
     ).
    </p>
    <p>
     A
     <span class="tex-font-style-tt">
      gcd
     </span>
     (greatest common divisor) of a set of numbers is the maximum integer that divides all integers in the set. Read more about gcd
     <a href="https://en.wikipedia.org/wiki/Greatest_common_divisor">
      here
     </a>
     .
    </p>
   </div>
  </div>
  <p>
  </p>
 </div>
</div>
